/**
 * Description:一些注释<br/>
 * CreateTime:2019-04-15<br/>
 * Creater: yangpengfei360@126.com <br/>
 * @author yangpengfei
 */
package cn.cnsy123.bookwebsiteserver.param;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import cn.cnsy123.bookwebsiteserver.validator.IpAddrValidator;

/**
 * Description:一些注释<br/>
 * CreateTime:2019-04-15<br/>
 * Creater: yangpengfei360@126.com <br/>
 * @author yangpengfei
 */
public class DbConfigInsertParam {
    @NotBlank(message = "数据源名称不能为空!")
    private String dbName;
    @NotBlank(message = "必须选择一种数据源类型!")
    private String dbType;
    @NotBlank(message = "IP地址不能为空!")
    @IpAddrValidator
    private String dbAccessIp;
    @NotNull(message = "数据源端口不能为空!")
    @Min(value = 5001L,message = "端口设置应该在5001~65535!")
    @Max(value = 65535L,message = "端口设置应该在5001~65535!")
    private Integer port;
    @NotBlank(message = "密码不能为空")
    private String passWord;


    public String getDbName() {
        return dbName;
    }

    public void setDbName(String dbName) {
        this.dbName = dbName;
    }

    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    public String getDbAccessIp() {
        return dbAccessIp;
    }

    public void setDbAccessIp(String dbAccessIp) {
        this.dbAccessIp = dbAccessIp;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public DbConfigInsertParam() {
        
    }

    public DbConfigInsertParam(String dbName, String dbType, String dbAccessIp, Integer port,
            String passWord) {
        this.dbName = dbName;
        this.dbType = dbType;
        this.dbAccessIp = dbAccessIp;
        this.port = port;
        this.passWord = passWord;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("{\"dbName\":");
        builder.append(dbName);
        builder.append(", \"dbType\":");
        builder.append(dbType);
        builder.append(", \"dbAccessIp\":");
        builder.append(dbAccessIp);
        builder.append(", \"port\":");
        builder.append(port);
        builder.append(", \"passWord\":");
        builder.append(passWord);
        builder.append("}");
        return builder.toString();
    }
    
    
    
    
}
